<?php

namespace libs\database\pdo;

class Connect {
    
    private $config;
    private $_connection;
    
    public function __construct($config) 
    {
        $this->config = $config;
    }
    
    public function connect()
    {
        $config = $this->config;
        
        $db = new \PDO("mysql:host=$config->host;dbname=$config->dbname;port=$config->port", $config->user, $config->password);
        
        $db->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); 
        
        $db->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false);
        
        return $db;
    }
}

?>
